package com.shop.action;

import java.util.List;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.AllowedMethods;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.shop.entity.Emp;
import com.shop.service.EmpService;
@Controller
@AllowedMethods("findAll")
public class EmpAction extends ActionSupport {
    @Resource
	private EmpService empService;
    @Action(value="empAction_findAll",
    	results={@Result(name="success",location="/success.jsp")  } )
	public String findAll(){
		List<Emp> list = empService.findAll();
		ActionContext.getContext().put("empList", list);
		return SUCCESS;
	}
	
	
	public EmpService getEmpService() {
		return empService;
	}

	public void setEmpService(EmpService empService) {
		this.empService = empService;
	}
	
	
}
